<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>{$infoConfig.site_title}</title>
    <link rel="stylesheet" href="/public/admin/layui/css/layui.css">
    <style>
        @media screen and (max-width: 767.98px){
            .layui-layout-left {left: 0;}
            .layui-layout-right{padding-right: 0;}
            .layui-nav-tree{width: auto;}
            .layui-layout-admin .layui-side{width: 85px;}
            .layui-side-scroll{width: auto;}
            .layui-body{left: 85px;}
            .layui-layout-admin .layui-footer{left: 85px;}
        }
    </style>
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs layui-bg-black">{$infoConfig.site_subtitle}</div>
        
        <!-- 头部区域（可配合layui 已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <!-- 移动端显示 -->
            <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
                <i class="layui-icon layui-icon-spread-left"></i>
            </li>

            <li class="layui-nav-item layui-hide-xs"><a href="javascript:;" class="data-ajax" data-url="{:url('home/main')}">首页</a></li>
            <li class="layui-nav-item">
                <a href="javascript:;">系统</a>
                <dl class="layui-nav-child">
                    <dd><a href="javascript:;" class="data-ajax" data-url="{:url('admin/index')}">系统管理</a></dd>
                    <dd><a href="javascript:;" class="data-ajax" data-url="{:url('set/site')}">系统配置</a></dd>
                    <dd><a href="javascript:;" class="data-ajax" data-url="{:url('backup/index')}">系统数据</a></dd>
                </dl>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                <a href="javascript:;">
                    <img src="//tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" class="layui-nav-img">
                    {$infoAdmin.nickname}
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="http://game.gopick.cn/" target="_blank">开始游戏</a></dd>
                    <dd><a href="http://123.58.217.105:1988/06c24f59" target="_blank">宝塔</a></dd>
					<dd><a href="javascript:;" class='layui-submit' data-type="clear" data-name='清理缓存' data-url='{:url("home/delCache")}'>清理缓存</a></dd>
                    <dd><a href="javascript:;" class='layui-submit' data-type="out" data-name='安全退出' data-url='{:url("index/outLogin")}'>安全退出</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item" style="margin-left: 10px;">
                <button title="刷新" class="layui-btn layui-btn-normal layui-refresh"><i class="layui-icon">&#xe669;</i></button>
            </li>
            <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
                <a href="javascript:;">
                    <i class="layui-icon layui-icon-more-vertical"></i>
                </a>
            </li>
        </ul>
    </div>
  
    <div class="layui-side layui-bg-black" data-status="1">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item"><a href="javascript:;" class="data-ajax" data-url="{:url('user/index')}">用户</a></li>
                <li class="layui-nav-item"><a href="javascript:;" class="data-ajax" data-url="{:url('role/index')}">角色</a></li>
                <li class="layui-nav-item"><a href="javascript:;" class="data-ajax" data-url="{:url('map/index')}">地图</a></li>
                <li class="layui-nav-item">
                    <a class="" href="javascript:;">模版</a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;" class="data-ajax" data-url="{:url('task/index')}">任务</a></dd>
                        <dd><a href="javascript:;" class="data-ajax" data-url="{:url('monster/index')}">怪物</a></dd>
                        <dd><a href="javascript:;" class="data-ajax" data-url="{:url('equip/index')}">装备</a></dd>
                        <dd><a href="javascript:;" class="data-ajax" data-url="{:url('prop/index')}">道具</a></dd>
                        <dd><a href="javascript:;" class="data-ajax" data-url="{:url('drug/index')}">药品</a></dd>
                        <dd><a href="javascript:;" class="data-ajax" data-url="{:url('skill/index')}">技能</a></dd>
                        <dd><a href="javascript:;" class="data-ajax" data-url="{:url('boss/index')}">领主</a></dd>
                        <dd><a href="javascript:;" class="data-ajax" data-url="{:url('pets/index')}">宠物</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">坊市</a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;" class="data-ajax" data-url="{:url('market/equip')}">装备</a></dd>
                        <dd><a href="javascript:;" class="data-ajax" data-url="{:url('market/prop')}">道具</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a href="javascript:;" class="data-ajax" data-url="{:url('npc/index')}">NPC</a></li>
                <li class="layui-nav-item"><a href="javascript:;" class="data-ajax" data-url="{:url('message/index')}">聊天</a></li>
                <li class="layui-nav-item"><a href="javascript:;" class="data-ajax" data-url="{:url('orders/index')}">订单</a></li>
                <li class="layui-nav-item"><a href="javascript:;" class="data-ajax" data-url="{:url('bug/index')}">BUG</a></li>
            </ul>
        </div>
    </div>
  
    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding:10px;height:100%;">
            <iframe style="width:100%;height:100%;border:none;" name="gopick_iframe" id="gopick_iframe" data-id='0' src="{:url('home/main')}"></iframe>
        </div>
    </div>
  
    <div class="layui-footer">
        {$infoConfig.site_copyright}
    </div>
</div>
<script src="/public/admin/layui/layui.js"></script>
<script>
//JS 
layui.use(['element', 'layer', 'util'], function(){
    var element = layui.element
        ,layer = layui.layer
        ,util = layui.util
        ,$ = layui.$;
    
    //头部事件
    util.event('lay-header-event', {
        //左侧菜单事件
        menuLeft: function(othis){console.log()
            var status = $('.layui-side').data('status');
            if(status==1){
                console.log('关闭左侧菜单的操作');
                $('.layui-side').data('status',0);
                $('.layui-side').css('width','66px');
                $('.layui-body').css('left','auto');
            }else{
                console.log('展开左侧菜单的操作');
                $('.layui-side').data('status',1);
                $('.layui-side').css('width','85px');
                $('.layui-body').css('left','85px');
            }
        }
        ,menuRight: function(){
            layer.open({
                type: 1
                ,content: '<div style="padding: 15px;">处理右侧面板的操作</div>'
                ,area: ['260px', '100%']
                ,offset: 'rt' //右上角
                ,anim: 5
                ,shadeClose: true
            });
        }
    });
    
    $('.data-ajax').on('click', function(){
        var url = $(this).data('url');
        console.log('url',url);
        
		$("#gopick_iframe").attr("src",url);

        $('.layui-layout-left .layui-this').removeClass("layui-this");
	});

    //刷新iframe
    $('.layui-refresh').on('click', function(){
        window.frames["gopick_iframe"].location.reload(true);
    });
	
	//通用按钮监听事件
	$('.layui-submit').on('click', function () {
		var type = $(this).attr('data-type');	//必填 del add edit clear
		var url = $(this).attr('data-url');		//必填
		var name = $(this).attr('data-name');	//必填
		var field = $(this).attr('data-field');
		var value = $(this).attr('data-value');

		if (typeof (type) != 'undefined') {
			layer.open({
				type: 1
				, title: '提示'
				, content: '<div style="padding:20px 100px;">确认 ' + name + ' 操作吗？</div>'
				, btn: '确定'
				, btnAlign: 'c' //按钮居中
				, shade: 0 //不显示遮罩
				, yes: function (index) {
					if (typeof (field) != 'undefined') {
						var data = {};
						data[field] = value;
					} else {
						var data = {};
						data['id'] = 1;
					}
					$.ajax({
						url: url,
						data: data,
						type: "post",
						dataType: 'json',
						success: function (res) {
							//数据处理
							layer.close(index);
							if (res.code == 1) {
								//返回OK 正常信息
								layer.msg(res.msg, {icon: 1, time: 1000}, function (index) {
									location.reload();
								});
							}
							if (res.code == 2) {
								//返回OK 临时性重定向
								layer.msg(res.msg, {icon: 1, time: 1000}, function (index) {
									window.location.href = res.data.url;
								});
							}
							if (res.code == 0) {
								//返回Error 返回错误
								layer.msg(res.msg, {icon: 2, time: 2000}, function (index) {

								});
							}
						}
					});
				}
			});
		}
	});

});
</script>
</body>
</html>